#include "junix.h"
#include <boost/function.hpp>
using namespace std;

void f(int i,int j)
{
	std::cout<<"("<<i<<","<<j<<")"<<std::endl;
}

void g(int i,int j,int k)
{
	std::cout<<"("<<i<<","<<j<<","<<k<<")"<<std::endl;
}

int main(int argc, char **argv)
{
	boost::function<void(int,int)> fun;
	fun = boost::bind(g,_1, 8888, _2);
	fun(123,987);

	/*
	boost::bind(f,1,2);
	boost::bind(f,1,2)();
	*/

	boost::function<void(int,int,int)> fun3;
	fun3=boost::bind(f,_1, _2);
	fun3(1,2,3);

	int num = 99;
	fun3=boost::bind(g,_1, boost::ref(num),_2);
	fun3(1,2,3);

	num = 100;
	fun3(1,2,3);

	boost::function<void(int,int,int,int)> fun4=
	boost::bind(g, _1, boost::ref(num), _4);

	fun4(1,2,3,4);


}
